gusucode.com > 耐品图片管理系统 标准版A > 耐品图片管理系统 标准版A/Admin_User.asp

    <!--#include file="Admin_ChkPurview.asp"-->
<!--#include file="Inc/Md5.asp"-->
<!--#include file="Api/Api_Class.asp"-->
<%
'===============================================================
' 著作权号:中国国家版权局著作权登记号2004SR07385
' 版权所有:深圳市耐品科技开发有限公司 www.naipin.com
' 联系电话:0755-26611119 81234844 81234845
' 联系手机:13316911914
' 联系邮箱:naipin@naipin.com
'===============================================================

dim strFileName,totalPut,CurrentPage,rs,sql,ID,Action
strFileName="Admin_User.asp"
Action=trim(request("Action"))
ID=trim(Request("ID"))
FindUser=trim(request.Form("FindUser"))

CurrentPage = Cint(Netout.CheckStr(request("page"),1))
%>
<html>
<head>
<title>注册用户管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT language=javascript>
function unselectall(){
    if(document.myform.chkAll.checked){
	document.myform.chkAll.checked = document.myform.chkAll.checked&0;
    } 	
}

function CheckAll(form){
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.Name != "")
		e.checked = form.chkAll.checked;
    }
}
function ChgThis(obj,UserID){
	this.location.href="Admin_User.asp?Action=Change&UserID="+UserID+"&GroupID="+obj.options[obj.selectedIndex].value;
}
</SCRIPT>
<%
Title="注 册 用 户 管 理"
Link="<a href='Admin_Add.asp' class='black'>添加图片</a> | <a href='Admin_Images.asp' class='black'>管理图片</a> | <a href='Admin_User.asp?Action=Add' class='black'>添加用户</a> | <a href='Admin_Class.asp' class='black'>管理分类</a> | <a href='Admin_SiteConfig.asp' class='black'>系统配置</a>"
Behind.WriteHtmlHead
Behind.WriteHtmlTop Title,Link

if Action="Add" then
	call AddUser()
elseif Action="SaveAdd" then
	call SaveAdd()
elseif Action="Modify" then
	call Modify()
elseif Action="SaveModify" then
	call SaveModify()
elseif Action="Del" then
	call DelUser()
elseif Action="Move" then
	call MoveUser()
elseif Action="Change" then
	UserID = Clng(request.QueryString("UserID"))
	GroupID = Clng(request.QueryString("GroupID"))
	Set rs = conn.Execute("select Setting from NT_UserGroup where ID="&GroupID)
	Setting = rs(0)
	Set rs = Nothing
	Conn.Execute("update NT_User Set GroupID="&GroupID&",Setting='"&Setting&"' where ID="&UserID)
	response.Redirect("Admin_User.asp")
else
	call main()
end if
if FoundErr=True then
	Behind.WriteErrMsg(ErrMsg)
	Set Netout = Nothing
end if

sub main()
	dim strGuide
	if FindUser="" then
		sql="select * from [NT_User] order by ID desc"
	else
		sql="select * from [NT_User] where UserName like '%"&FindUser&"%' order by ID desc"
	end if
	if FoundErr=True then exit sub
	
	dim rs
	With Behind
		.MaxPerPage	 = 18
		.TopPage	 = False
		.BottomPage	 = True
		.SqlRecord	 = sql
		.InitText	 = "个用户"
		.strFileName = "Admin_User.asp?"
		.ShowRecord CurrentPage
		SearchUser
	End With
end sub

sub showContent(MaxPerPage)
   	dim i
    i=0
%>
<table width='100%' border="0" cellpadding="0" cellspacing="0">
  <tr>
  <form name="myform" method="Post" action="Admin_User.asp" onSubmit="return confirm('确定要执行选定的操作吗?');">
      <td> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
          <tr class="title"> 
            <td width="44" align="center" class="tdbg1">选中</td>
            <td width="158" height="22" align="center" class="tdbg1">用户名</td>
            <td width="60" height="22" align="center" class="tdbg1">真实姓名</td>
            <td width="247" height="22" align="center" class="tdbg1">级别</td>
			<%
			If Not Purchase Is Nothing Then
				Purchase.ShowUserColumn_Header
			End If
			%>
            <td width="210" height="22" align="center" class="tdbg1">操作</td>
          </tr>
          <%do while not rs.EOF and i<MaxPerPage%>
          <tr class="tdbg" onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EBEBEB'"> 
            <td align="center"><input name='ID' type='checkbox' onClick="unselectall()" id="ID" value='<%=cstr(rs("ID"))%>'<%IF Netout.UserName=rs("UserName") Then Response.Write(" disabled")%>></td>
            <td align="center"><%=rs("UserName")%></td>
            <td align="center"><%=rs("TrueName")%></td>
            <td align="center"> 
              <%GroupID = rs("GroupID")%>
              <select name="GroupID" onChange="ChgThis(this,<%=rs("ID")%>);"<%IF Netout.UserName=rs("UserName") Then Response.Write(" disabled")%>>
                <option value="1" <%if GroupID=1 then%>selected<%end if%>>管理员</option>
                <option value="2" <%if GroupID=2 then%>selected<%end if%>>摄影师</option>
                <option value="3" <%if GroupID=3 then%>selected<%end if%>>高级会员</option>
                <option value="4" <%if GroupID=4 then%>selected<%end if%>>普通会员</option>
              </select>
			</td>
			<%
			If Not Purchase Is Nothing Then
				Purchase.ShowUserColumn_Repeat Rs
			End If
			%>
            <td align="center"> 
              <%
			response.write "<a href='Admin_User.asp?Action=Modify&ID=" & rs("ID") & "' class='black'>修改</a> | "
			IF Netout.UserName=rs("UserName") Then
				response.write "<a href='#' class='black' onClick='alert(""对不起,您不能删除自己!"");'>删除</a>"
			Else
				response.write "<a href='Admin_User.asp?Action=Del&ID=" & rs("ID") & "' class='black' onClick='return confirm(""确定要删除此用户吗?"");'>删除</a>"
			End IF
			%>
            </td>
          </tr>
          <%
			i=i+1
			rs.movenext
			loop
			%>
        </table>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
	  <tr>
            <td width="275" height="30">
			<font color="#FFFFFF">网</font><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
              选中本页所有用户</td>
            <td width="718"> <strong>操作:</strong> 
              <input name="Action" type="radio" value="Del">
              删除&nbsp; 
              <input name="Action" type="radio" value="Move" checked>
              移动到 
              <select name="MoveGroupID">
                <option value="1">管理员</option>
                <option value="2">摄影师</option>
				<option value="3">高级会员</option>
				<option value="4">普通会员</option>
              </select> &nbsp;&nbsp; 
              <input type="submit" name="Submit" value=" 执 行 "> </td>
  </tr>
</table>
</td>
</form></tr></table>
<%
end sub

sub SearchUser()
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
  <form name="form1" action="Admin_User.asp" method="post">
    <tr class="tdbg">
      <td width="167" height="30"><strong>快速查找用户:</strong></td>
      <td width="813" height="30"><input name="FindUser" type="text" id="FindUser" size="12">
          <input type="submit" name="Submit3" value=" 查 找 ">
		&nbsp;<a href="Admin_User.asp?Action=Add" class="black">添加用户</a></td>
    </tr>
  </form>
</table>
<%
end sub

sub AddUser()
%>
<form action="Admin_User.asp?Action=SaveAdd" method="post" name="form1">
  <table width=100% border=0 cellpadding=2 cellspacing=1 class="border">
    <TR align=center class='title'> 
      <TD height=22 colSpan=2 class=tdbg1><b>添 加 新 用 户</b></TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><b>用户名:</b><BR>
        不能超过14个字符(7个汉字)</TD>
      <TD width="60%"> <INPUT   maxLength=14 size=30 name=UserName> <font color="#FF0000">*</font></TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><b>真实姓名:</b></TD>
      <TD width="60%"> <INPUT   maxLength=14 size=30 name=TrueName></TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><b>作品署名:</b></TD>
      <TD width="60%"> <INPUT   maxLength=14 size=30 name=ManuName></TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><B>密码(至少6位):</B><BR>
      请输入密码,区分大小写。 请不要使用任何类似 '*'、' ' 或 HTML 字符 </TD>
      <TD width="60%"> <INPUT   type=password maxLength=50 size=30 name=Password> 
        <font color="#FF0000">*</font> </TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><strong>确认密码:</strong><BR>
        </TD>
      <TD width="60%"> <INPUT   type=password maxLength=50 size=30 name=PrePassword> 
        <font color="#FF0000">*</font> </TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><strong>邮箱:</strong></TD>
      <TD width="60%"><INPUT name=UserEmail id="UserEmail" size=30   maxLength=50><font color="#FF0000">*</font> </TD>
    </TR>
<%
If Not Purchase Is Nothing Then
	Purchase.ShowAddUserLine
End If
%>	
    <tr class="tdbg">
      <td height="12"><b>密码提示问题:</b></td>
      <td>
        <INPUT name=Question id="Question" size=30   maxLength=50>
        <font color="#FF0000">*</font></td>
    </tr>
    <tr class="tdbg">
      <td height="12"><b>密码问题答案:</b></td>
      <td>
        <INPUT name=Answer id="Answer" size=30   maxLength=50>
        <font color="#FF0000">*</font>      </td>
    </tr>
    <tr class="tdbg"> 
      <td height="12"><strong>个性图片:</strong></td>
      <td><iframe ID="UploadFiles" src="Upload.asp?UpType=UserPic&Pos=in,add" frameborder=0 scrolling=no width="300" height="22"></iframe><input name="Image" type="hidden" id="Image"> 
      </td>
    </tr>
    <TR class="tdbg" >
      <TD><strong>电话:</strong></TD>
      <TD><INPUT name=Phone id="Phone" size=30   maxLength=50></TD>
    </TR>
    <TR class="tdbg" >
      <TD><strong>手机:</strong></TD>
      <TD><INPUT name=Mobile id="Mobile" size=30   maxLength=50></TD>
    </TR>
    <TR class="tdbg" > 
      <TD><strong>用户级别:</strong></TD>
      <TD width="60%"><select name="GroupID" id="select3">
        <option value="1">管理员</option>
        <option value="2">摄影师</option>
		<option value="3">高级会员</option>
		<option value="4">普通会员</option>
        </select></TD>
    </TR>
    <TR align="center" class="tdbg" > 
      <TD colspan="2">
        <input type="submit" name="Submit" value=" 添 加 "></TD>
    </TR>
  </TABLE>
</form>
<%
end sub

sub Modify()
	dim ID
	dim rsUser,sqlUser
	ID=trim(request("ID"))
	if ID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>参数不足!</li>"
		exit sub
	else
		ID=Clng(ID)
	end if
	Set rsUser=Server.CreateObject("Adodb.RecordSet")
	sqlUser="select * from NT_User where ID=" & ID
	rsUser.Open sqlUser,conn,1,3
	if rsUser.bof and rsUser.eof then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>找不到指定的用户!</li>"
		rsUser.close
		set rsUser=nothing
		exit sub
	end if
%>
<FORM name="form1" action="Admin_User.asp?Action=SaveModify" method="post">
  <table width="100%" border="0" cellspacing="1" cellpadding="2" class="border">
    <TR class='title'> 
      <TD height=22 colSpan=2 align="center" class="tdbg1"><b>修改注册用户信息</b></TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><b>用户名:</b></TD>
      <TD width="60%"><%=rsUser("UserName")%><input type="hidden" name="UserName" value="<%=rsUser("UserName")%>">
        <input name="ID" type="hidden" id="ID" value="<%=ID%>"></TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><b>真实姓名:</b></TD>
      <TD width="60%"> <INPUT   maxLength=14 size=30 name=TrueName value="<%=rsUser("TrueName")%>"></TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><b>作品署名:</b></TD>
      <TD width="60%"> <INPUT   maxLength=14 size=30 name=ManuName value="<%=rsUser("ManuName")%>"></TD>
    </TR>
    <TR class="tdbg" > 
      <TD width="40%"><B>密码(至少6位):</B><BR>
      请输入密码,区分大小写。 请不要使用任何类似 '*'、' ' 或 HTML 字符 </TD>
      <TD width="60%"> <INPUT   type=password maxLength=50 size=30 name=Password> 
        <font color="#FF0000">如果不想修改,请留空</font> </TD>
    </TR>
    <TR class="tdbg" > 
      <TD><strong>确认密码:</strong></TD>
      <TD><INPUT name=PrePassword   type=password id="PrePassword" size=30 maxLength=50> 
        <font color="#FF0000">如果不想修改,请留空</font> </TD>
    </TR>
    <TR class="tdbg" > 
      <TD><strong>邮箱:</strong></TD>
      <TD><INPUT name=UserEmail id="UserEmail" size=30   maxLength=50 value="<%=rsUser("UserEmail")%>"><font color="#FF0000">*</font>  </TD>
    </TR>
<%
If Not Purchase Is Nothing Then
	Purchase.ShowModifyUserLine RsUser
End If
%>	
    <tr class="tdbg">
      <td height="12"><b>密码提示问题:</b></td>
      <td>
        <INPUT name=Question id="Question" size=30   maxLength=50 value="<%=rsUser("Question")%>"></td>
    </tr>
    <tr class="tdbg">
      <td height="12"><b>密码问题答案:</b></td>
      <td>
        <INPUT name=Answer id="Answer" size=30   maxLength=50>
        <font color="#FF0000">如果不想修改,请留空</font></td>
    </tr>
    <tr class="tdbg"> 
      <td height="12"><strong>个性图片:</strong></td>
      <td><iframe ID="UploadFiles" src="Upload.asp?UpType=UserPic&Pos=in,mod" frameborder=0 scrolling=no width="300" height="22"></iframe><input name="Image" type="hidden" id="Image"> 
      <font color="#FF0000">如果不想修改,请留空</font>      </td>
    </tr>
    <TR class="tdbg" >
      <TD><strong>电话:</strong></TD>
      <TD><INPUT name=Phone id="Phone" size=30   maxLength=50 value="<%=rsUser("Phone")%>"></TD>
    </TR>
    <TR class="tdbg" >
      <TD><strong>手机:</strong></TD>
      <TD><INPUT name=Mobile id="Mobile" size=30   maxLength=50 value="<%=rsUser("Mobile")%>"></TD>
    </TR>
	<%IF Netout.UserName = rsUser("UserName") Then%>
		<input type="hidden" name="GroupID" value="<%=rsUser("GroupID")%>">
	<%Else%>
    <TR class="tdbg" >
    	<TD><strong>用户级别:</strong></TD>
    	<TD><select name="GroupID" id="GroupID">
        	<option value="1" <%if rsUser("GroupID")=1 then%>selected<%end if%>>管理员</option>
        	<option value="2" <%if rsUser("GroupID")=2 then%>selected<%end if%>>摄影师</option>
        	<option value="3" <%if rsUser("GroupID")=3 then%>selected<%end if%>>高级会员</option>
        	<option value="4" <%if rsUser("GroupID")=4 then%>selected<%end if%>>普通会员</option>
        	</select></TD>
   	</TR>
	<%End IF%>
    <TR class="tdbg" > 
      <TD height="25" colspan="2"><div align="center"> 
          <input type="submit" name="Submit2" value=" 修 改 ">
        </div></TD>
    </TR>
  </TABLE>
</form>
<%
rsUser.close
set rsUser=nothing
end sub

sub SaveAdd()
	Dim UserName,TrueName,ManuName,Password,PrePassword,UserEmail,UserPic,GroupID,question,answer
	
	UserName=trim(request.Form("UserName"))
	TrueName = Server.HTMLEncode(Trim(Request.Form("TrueName")))
	ManuName = Server.HTMLEncode(Trim(Request.Form("ManuName")))
	Password=trim(request.Form("Password"))
	PrePassword=trim(request.Form("PrePassword"))
	UserEmail=trim(request.Form("UserEmail"))
	Question=Trim(Request.Form("Question"))
	Answer=Trim(Request.Form("Answer"))
	UserPic=Trim(Request.Form("Image"))
	Phone=request.Form("Phone")
	Mobile=request.Form("Mobile")
	GroupID=clng(request.Form("GroupID"))
	
	set rs=conn.execute("select Setting from NT_UserGroup where ID="&GroupID)
	Setting=rs(0)
	rs.close
	set rs=nothing
	
	if UserName="" or Netout.strLength(UserName)>14 or Netout.strLength(UserName)<4 then
		FoundErr=true
		ErrMsg=ErrMsg & "<br><li>请输入用户名(不能大于14小于4)</li>"
	else
  		if Instr(UserName,"=")>0 or Instr(UserName,"%")>0 or Instr(UserName,chr(32))>0 or Instr(UserName,"?")>0 or Instr(UserName,"&")>0 or Instr(UserName,";")>0 or Instr(UserName,",")>0 or Instr(UserName,"'")>0 or Instr(UserName,",")>0 or Instr(UserName,chr(34))>0 or Instr(UserName,chr(9))>0 or Instr(UserName,"")>0 or Instr(UserName,"$")>0 then
			ErrMsg=ErrMsg+"<br><li>用户名中含有非法字符</li>"
			FoundErr=true
		end if
	end if
	if Password="" or Netout.strLength(Password)>50 or Netout.strLength(Password)<6 then
		FoundErr=true
		ErrMsg=ErrMsg & "<br><li>请输入密码(不能小于6或大于50)</li>"
	else
		if Instr(Password,"=")>0 or Instr(Password,"%")>0 or Instr(Password,chr(32))>0 or Instr(Password,"?")>0 or Instr(Password,"&")>0 or Instr(Password,";")>0 or Instr(Password,",")>0 or Instr(Password,"'")>0 or Instr(Password,",")>0 or Instr(Password,chr(34))>0 or Instr(Password,chr(9))>0 or Instr(Password,"")>0 or Instr(Password,"$")>0 then
			ErrMsg=ErrMsg+"<br><li>密码中含有非法字符</li>"
			FoundErr=true
		end if
	end if
	if Password<>PrePassword then
		FoundErr=true
		ErrMsg=ErrMsg & "<br><li>密码和确认密码不一致</li>"
	end if
	if UserEmail="" then
		FoundErr = True
		ErrMsg = ErrMsg & "<br><li>请填写邮箱地址!</li>"
	Else
		if Netout.chkEmail(UserEmail)=false then
			ErrMsg=ErrMsg & "<br><li>您的UserEmail有错误</li>"
  			FoundErr=true
		end if
	end if
	If Question="" Or Answer="" Then
		ErrMsg=ErrMsg & "<br><li>密码提示问题和答案不能为空!</li>"
		FoundErr=true
	End If

	if FoundErr=true then
		exit sub
	end if
	
	dim sqlReg,rsReg
	sqlReg="select * from NT_User where UserName='" & UserName & "'"
	set rsReg=server.createobject("adodb.recordset")
	rsReg.open sqlReg,conn,1,3
	if rsReg.bof and rsReg.eof then
		'-----------------------------------------------------------------
		'系统整合
		'-----------------------------------------------------------------
		Dim objApi,Api_SaveCookie,SysKey
		If Api_Enable Then
			Set objApi = New Lyout_Api
			
			objApi.NodeValue "action","reguser",0,False
			objApi.NodeValue "username",UserName,1,False
			objApi.NodeValue "truename",TrueName,1,False
			
			Md5OLD = 1
			SysKey = Md5(objApi.XmlNode("username")&Api_SysKey,Api_Md5_Len)
			Md5OLD = 0
			
			objApi.NodeValue "syskey",SysKey,0,False
			objApi.NodeValue "password",Password,0,False
			objApi.NodeValue "email",UserEmail,1,False
			objApi.NodeValue "question",Question,1,False
			objApi.NodeValue "answer",Answer,1,False
			objApi.NodeValue "mobile",Mobile,1,False
			objApi.NodeValue "phone",Phone,1,False
			objApi.SendHttpData
			
			If objApi.Status = "1" Then
				FoundErr = True
				ErrMsg = objApi.Message
				Exit Sub
			End If
			Set objApi = Nothing
		End If

		rsReg.addnew
		rsReg("UserName")=UserName
		rsReg("TrueName")=TrueName
		rsReg("ManuName")=ManuName
		rsReg("Password")=MD5(Password,Api_Md5_Len)
		rsReg("UserEmail")=UserEmail
		rsReg("Question")=Question
		rsReg("Answer")=MD5(Answer,Api_Md5_Len)
		rsReg("Phone")=Phone
		rsReg("Mobile")=Mobile
		rsReg("GroupID")=GroupID
		rsReg("Setting")=Setting
		If Not Purchase Is Nothing Then
			Purchase.SaveAddUser rsReg,Purchase.GetAddUser(Request)
		End If
		if UserPic<>"" then rsReg("UserPic")=UserPic
		rsReg.update
	Else
		FoundErr=true
		ErrMsg=ErrMsg & "<br><li>您注册的用户已经存在!请换一个用户名再试!</li>"
		Exit Sub
	End If
	rsReg.close
	set rsReg=nothing
	Set Netout = Nothing
	response.Redirect strFileName
end sub		

sub SaveModify()
	dim ID,UserName,TrueName,ManuName,Password,PrePassword,UserEmail,GroupID,UserPic,Question,Answer
	dim rsUser,sqlUser
	ID=trim(request("ID"))
	if ID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>参数不足!</li>"
		exit sub
	else
		ID=Clng(ID)
	end if
	UserName=trim(request.Form("UserName"))
	TrueName = Server.HTMLEncode(Trim(Request.Form("TrueName")))
	ManuName = Server.HTMLEncode(Trim(Request.Form("ManuName")))
	Password=trim(request.Form("Password"))
	PrePassword=trim(request.Form("PrePassword"))
	UserEmail=trim(request.Form("UserEmail"))
	Question=Trim(Request.Form("Question"))
	Answer=Trim(Request.Form("Answer"))
	Phone=request.Form("Phone")
	Mobile=request.Form("Mobile")
	GroupID=clng(request.Form("GroupID"))
	UserPic=Trim(Request.Form("Image"))
	
	if Password<>"" then
		IF Netout.strLength(Password)>50 or Netout.strLength(Password)<6 then
			FoundErr=true
			ErrMsg=ErrMsg & "<br><li>请输入密码(不能小于6或大于50)</li>"
		End IF
		if Instr(Password,"=")>0 or Instr(Password,"%")>0 or Instr(Password,chr(32))>0 or Instr(Password,"?")>0 or Instr(Password,"&")>0 or Instr(Password,";")>0 or Instr(Password,",")>0 or Instr(Password,"'")>0 or Instr(Password,",")>0 or Instr(Password,chr(34))>0 or Instr(Password,chr(9))>0 or Instr(Password,"")>0 or Instr(Password,"$")>0 then
			ErrMsg=ErrMsg+"<br><li>密码中含有非法字符</li>"
			FoundErr=true
		end if
	end if
	if Password<>PrePassword then
		FoundErr=true
		ErrMsg=ErrMsg & "<br><li>密码和确认密码不一致</li>"
	end if
	if UserEmail="" then
		FoundErr = True
		ErrMsg = ErrMsg & "<br><li>邮箱地址不能为空</li>"
	Else
		if Netout.chkEmail(UserEmail)=false then
			ErrMsg=ErrMsg & "<br><li>您的UserEmail有错误</li>"
  			FoundErr=true
		end if
	end if

	if FoundErr=true then
		exit sub
	end if
			
	'-----------------------------------------------------------------
	'系统整合
	'-----------------------------------------------------------------
	Dim objApi,SysKey
	If Api_Enable Then
		Set objApi = New Lyout_Api
		objApi.NodeValue "action","update",0,False
		objApi.NodeValue "username",UserName,1,False
		objApi.NodeValue "truename",TrueName,1,False
		Md5OLD = 1
		SysKey = Md5(objApi.XmlNode("username")&Api_SysKey,Api_Md5_Len)
		Md5OLD = 0
		objApi.NodeValue "syskey",SysKey,0,False
		objApi.NodeValue "password",Password,1,False
		objApi.NodeValue "email",UserEmail,1,False
		objApi.NodeValue "question",Question,1,False
		objApi.NodeValue "answer",Answer,1,False
		objApi.NodeValue "mobile",Mobile,1,False
		objApi.NodeValue "phone",Phone,1,False
		objApi.SendHttpData
		If objApi.Status = "1" Then
			FoundErr = True
			ErrMsg = objApi.Message
			Exit Sub
		End If
		Set objApi = Nothing
	End If
	
	Set rs = Conn.Execute("Select Setting from NT_UserGroup where ID="&GroupID)
	Setting = rs(0)
	Set rs = Nothing
	
	sqlUser="select * from NT_User where ID=" & ID
	set rsUser=server.createobject("adodb.recordset")
	rsUser.open sqlUser,conn,1,3
	rsUser("TrueName")=TrueName
	rsUser("ManuName")=ManuName
	If Question<>"" Then rsUser("Question")=Question
	If Answer<>"" Then rsUser("Answer")=MD5(Answer,Api_Md5_Len)
	rsUser("UserEmail")=UserEmail
	rsUser("Phone")=Phone
	rsUser("Mobile")=Mobile
	rsUser("GroupID")=GroupID
	rsUser("Setting")=Setting
	if Password<>"" then rsUser("Password")=MD5(Password,Api_Md5_Len)
	if UserPic<>"" then
		UserImage = rsUser("UserPic")&""
		if UserImage<>"" then
			UserImage = Split(UserImage,",")
			Netout.DelFile(UserImage(0))
		end if
		rsUser("UserPic")=UserPic
	end if
	If Not Purchase Is Nothing Then
		Purchase.SaveModifyUser rsUser,Purchase.GetModifyUser(Request)
	End If
	rsUser.update
	rsUser.close
	set rsUser=nothing

	If Config.Settings(27) = "1" And Config.WaterMark(0) = "1" And IsHttpUrl Then
		DataValue = Config.SystemUrl&"#%##"&UserName&"$##@"&TrueName&"$##@"&ManuName&"$##@"&UserEmail&"$##@"&Phone&"$##@"&Mobile
		Netout.SendData "EditInfo.asp?Action=User",DataValue
	End If
	Set Netout = Nothing
	response.Redirect strFileName
end sub

sub DelUser()
	'On Error Resume Next
	dim UserPic,AllUserName
	ID=trim(request("ID"))
	if ID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>请指定要删除的用户</li>"
		exit sub
	end if
	
	AllUserName = ","
	
	set rs=conn.execute("select UserName,UserPic from NT_User where ID in (" & ID & ")")
	do while not rs.eof
		If trim(rs("UserPic")&"")<>"" Then UserPic=UserPic&","&rs("UserPic")
		AllUserName = AllUserName & rs("UserName") & ","
		rs.movenext
	loop
	set rs=nothing

	AllUserName = Left(AllUserName,Len(AllUserName)-1)

	'-----------------------------------------------------------------
	'系统整合
	'-----------------------------------------------------------------
	Dim objApi,SysKey
	If Api_Enable Then
		Set objApi = New Lyout_Api
		objApi.NodeValue "action","delete",0,False
		objApi.NodeValue "username",AllUserName,1,False
		Md5OLD = 1
		SysKey = Md5(objApi.XmlNode("username")&Api_SysKey,Api_Md5_Len)
		Md5OLD = 0
		objApi.NodeValue "syskey",SysKey,0,False
		objApi.SendHttpData
		Set objApi = Nothing
	End If

	Conn.Execute "delete from NT_User where [ID] in (" & ID & ")"

	UserPic=split(UserPic,",")
	For i = 1 to Ubound(UserPic)
		if Instr(UserPic(i),"Default")<=0 then	Netout.DelFile(UserPic(i))
	Next
	
	If Config.Settings(27) = "1" And Config.WaterMark(0) = "1" And IsHttpUrl Then
		DataValue = Config.SystemUrl&"#%##"&ID
		Netout.SendData "DelData.asp?Action=User",DataValue
	End If

	Set Netout = Nothing
	response.redirect strFileName
end sub

sub MoveUser()
	ID=trim(request("ID"))
	if ID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>请选择需要移动的用户</li>"
		exit sub
	end if
	dim GroupID
	GroupID=Request.Form("MoveGroupID")
	if GroupID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>请指定目标用户组</li>"
		exit sub
	else
		GroupID=Clng(GroupID)
	end if
	Set rs = Conn.Execute("Select Setting from NT_UserGroup where ID="&GroupID)
	Setting = rs(0)
	Set rs = Nothing
	sql="Update NT_User set GroupID=" & GroupID & ",Setting='"&Setting&"' where ID in (" & ID & ")"
	conn.Execute sql
	Set Netout = Nothing
	response.redirect strFileName
end sub
%>